x = [0.6, 0.7, 0.8, 0.9, 1.0]
phi_x = [1.24110, 1.40917, 1.66863, 2.07301, 2.71828]

h = 0.1
x_0 = 0.8

def diff_centrada_phi_x(phi_x, x_0, h, i):
    ind = x.index(x_0)
    return (phi_x[ind + i] - phi_x[ind - i])/(2*i*h)

def diff_cuatro_puntos_phi_x(phi_x, x_0, h, i):
    ind = x.index(x_0)
    return (phi_x[ind - 2*i] - phi_x[ind + 2*i] + 8*phi_x[ind + i] - 8*phi_x[ind - i])/(12*h*i)

for i in range(2, 0, -1):
    print(f"ec. 10, h = {h*i}: \t {diff_centrada_phi_x(phi_x, x_0, h, i):.5f}")
print(f"ec. 15, h = {h}: \t {diff_cuatro_puntos_phi_x(phi_x, x_0, h, 1):.5f}")